﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BusinessService.Plugin.Helper
{
  public  class JsonFile
    {
        IConfigurationRoot config;
        public JsonFile()
        {
            //配置服务
            var builder = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                 .AddJsonFile(@"Settings\dbsettings.json");
                  config = builder.Build();
        }

        /// <summary>
        /// 获取路径
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public string  Config(string  path)
        {
            var temp = config[path];
            if (string.IsNullOrEmpty(temp)) return "";        
            return temp;

        }
    }
}
